<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
   <title>Untitled Document</title>
   <link rel="stylesheet" href="unifor.css" type="text/css" />
</head>

<body>
    <form action="FrontController" method="post" name="cadDespesa">
    <label>Cadastro Despesa
   <c:choose>      
      <c:when test="${not empty requestScope.expense }">        
         <input type="hidden" name="op" value="expenseEdit">                      
         <c:set var="expense" value="${requestScope.expense}"/>
         <input type="hidden" name="expenseId" value="${expense.id}">    
         <table width="200" border="0">
            <tr>
               <th scope="row">Nome</th>
               <td><input type="text" name="description" value="${expense.description}"/></td>
            </tr>
            <tr>
               <th scope="row">Valor</th>
               <td><input type="text" name="totalValue" value="${expense.totalValue}"/></td>
            </tr>            
            <!--<tr>
               <th scope="row">Tipo</th>
               <td><input type="text" name="expenseType" value="${expense.expenseType}"/></td>
            </tr>           
            <tr>
               <th scope="row">Data</th>
               <td><input type="text" name="date" />expense.date</td>
            </tr>-->
            <tr>
               <th scope="row">Parcelas</th>
               <td><input type="text" name="payments" value="${expense.payments}"/></td>
            </tr>
            <tr> 
               <td colspan="2" align="right"><input type="submit" value="Ok">
                  <input type="button" value="Cancel" onClick="javascript:window.close();" />
               </td>
            </tr>
         </table>
      </c:when>
      <c:otherwise>         
         <input type="hidden" name="op" value="expenseCreate">                             
         <table width="200" border="0">
            <tr>
               <th scope="row">Nome</th>
               <td><input type="text" name="description" /></td>
            </tr>
            <tr>
               <th scope="row">Valor</th>
               <td><input type="text" name="totalValue" /></td>
            </tr>
            <tr> 
               <td colspan="2" align="right"><input type="submit" value="Ok">
                  <input type="button" value="Cancel" onClick="javascript:window.close();" />
               </td>
            </tr>
         </table>
      </c:otherwise>
   </c:choose>      
</label>
</form>
</body>
</html>
